home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / minix / up1510b.tgz / up1510b / include / signal.h < prev    next >
C/C++ Source or Header  |  1990-07-23  |  4KB  |  115 lines

  1. /* The <signal.h> header defines all the ANSI and POSIX signals.
  2.  * MINIX supports all the signals required by POSIX. They are defined below.
  3.  * Some additional signals are also supported.
  4.  */
  5.  
  6. #ifndef _SIGNAL_H
  7. #define _SIGNAL_H
  8.  
  9. /* Here are types that are closely associated with signal handling. */
  10. typedef int sig_atomic_t;
  11.  
  12. #ifdef    _POSIX_SOURCE
  13. typedef unsigned short sigset_t;
  14. #endif
  15.  
  16.  
  17. #define _NSIG             16    /* number of signals used */
  18.  
  19. #define SIGHUP               1    /* hangup */
  20. #define SIGINT             2    /* interrupt (DEL) */
  21. #define SIGQUIT            3    /* quit (ASCII FS) */
  22. #define SIGILL             4    /* illegal instruction */
  23. #define SIGTRAP            5    /* trace trap (not reset when caught) */
  24. #define SIGABRT            6    /* IOT instruction */
  25. #define SIGIOT             6    /* SIGABRT for people who speak PDP-11 */
  26. #define SIGUNUSED          7    /* spare code */
  27. #define SIGFPE             8    /* floating point exception */
  28. #define SIGKILL            9    /* kill (cannot be caught or ignored) */
  29. #define SIGUSR1           10    /* user defined signal # 1 */
  30. #define SIGSEGV           11    /* segmentation violation */
  31. #define SIGUSR2           12    /* user defined signal # 2 */
  32. #define SIGPIPE           13    /* write on a pipe with no one to read it */
  33. #define SIGALRM           14    /* alarm clock */
  34. #define SIGTERM           15    /* software termination signal from kill */
  35. #define SIGSTKFLT         16    /* used by kernel to indicate stack fault */
  36.  
  37. #define SIGEMT             7    /* obsolete */
  38. #define SIGBUS            10    /* obsolete */
  39.  
  40. /* POSIX requires the following signals to be defined, even if they are
  41.  * not supported.  Here are the definitions, but they are not supported.
  42.  */
  43. #define SIGCHLD           17    /* child process terminated or stopped */
  44. #define SIGCONT           18    /* continue if stopped */
  45. #define SIGSTOP           19    /* stop signal */
  46. #define SIGTSTP           20    /* interactive stop signal */
  47. #define SIGTTIN           21    /* background process wants to read */
  48. #define SIGTTOU           22    /* background process wants to write */
  49.  
  50. #ifdef _POSIX_SOURCE
  51. #define SA_NOCLDSTOP       1    /* signal parent if child stops */
  52.  
  53. #endif /* _POSIX_SOURCE */
  54.  
  55. /* POSIX requires these values for use on system calls involving signals. */
  56. #define SIG_BLOCK          0    /* for blocking signals */
  57. #define SIG_UNBLOCK        1    /* for unblocking signals */
  58. #define SIG_SETMASK        2    /* for setting the signal mask */
  59.  
  60. #ifndef _ANSI_H
  61. #include <ansi.h>
  62. #endif
  63.  
  64. /* Macros used as function pointers and one awful prototype. */
  65. #if _ANSI
  66. #define SIG_DFL        ((void (*)(int))0)    /* default signal handling */
  67. #define SIG_IGN        ((void (*)(int))1)    /* ignore signal */
  68. #define SIG_ERR        ((void (*)(int))-1)
  69.  
  70. void (*signal(int _sig, void (*_func)(int)))(int);
  71.  
  72. #ifdef _POSIX_SOURCE
  73. struct sigaction {
  74.   void (*sa_handler)(int);    /* SIG_DFL, SIG_IGN, or pointer to function */
  75.   sigset_t sa_mask;        /* signals to be blocked during handler */
  76.   int sa_flags;            /* special flags */
  77. };
  78. #endif
  79.  
  80. #else    /* !_ANSI */
  81. #define SIG_DFL        ((void (*)())0)        /* default signal handling */
  82. #define SIG_IGN        ((void (*)())1)        /* ignore signal */
  83. #define SIG_ERR        ((void (*)())-1)
  84.  
  85. void (*signal()) ();
  86.  
  87. #ifdef _POSIX_SOURCE        /* otherwise sigset_t is not defined */
  88. struct sigaction {
  89.   void (*sa_handler)();        /* SIG_DFL, SIG_IGN, or pointer to function */
  90.   sigset_t sa_mask;        /* signals to be blocked during handler */
  91.   int sa_flags;            /* special flags */
  92. };
  93. #endif
  94.  
  95. #endif    /* _ANSI */
  96.  
  97. /* Function Prototypes. */
  98. _PROTOTYPE( int raise, (int _sig)                    );
  99.  
  100. #ifdef _POSIX_SOURCE
  101. _PROTOTYPE( int kill, (pid_t _pid, int _sig)                );
  102. _PROTOTYPE( int sigaddset, (sigset_t *_set)                );
  103. _PROTOTYPE( int sigdelset, (sigset_t *_set)                );
  104. _PROTOTYPE( int sigemptyset, (sigset_t *_set)                );
  105. _PROTOTYPE( int sigfillset, (sigset_t *_set)                );
  106. _PROTOTYPE( int sigismember, (sigset_t *_set, int _signo)        );
  107. _PROTOTYPE( int sigpending, (sigset_t *set)                );
  108. _PROTOTYPE( int sigprocmask, (int _how, sigset_t *_set, sigset_t *_oset));
  109. _PROTOTYPE( int sigsuspend, (sigset_t *_sigmask)            );
  110. _PROTOTYPE( int sigaction,
  111.         (int _sig, struct sigaction *_a, struct sigaction *_oact)    );
  112. #endif
  113.  
  114. #endif /* _SIGNAL_H */
  115.